<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>上序反馈</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<link href="./css/BtnStyle.css" rel="stylesheet">
<link href="./css/LiChildrenStyle.css" rel="stylesheet">
<link href="./css/UlStyle.css" rel="stylesheet">
<style type="text/css">

ul .sLi a{
    vertical-align: bottom; 
    float: left
    
}
ul .sLi a div{ 
    padding-top:0.2em;
    vertical-align: middle; 
   
}

.li_body {
    margin-top: 0.5em;
    min-height: 6em;
    line-height: 6em;
    background-color: white;
}

.childrenLeft{
    width:14%;
}
.childrenRight{
    width:86%;
    margin-left: 14%;
}
.btn{
   	float: left;
   	margin-top: 1em;
}

.childrenRight ul li label .radio {
	clear: both;
	width: 2.4em;
	height:2.4em;
	vertical-align: middle;
}

.li_noborder{
    border: none;

}
</style>
<script type="text/javascript" src="./plugins/jquery-1.8.2.min.js"></script>

<script type="text/javascript">
    var ScCode = "";
    var OrderName = "";
    var saveFlag = false;
    var lOrderInfo  =null;
    window.onload = function loading() {
		getParams();
	}
	
	
	function getParams() {
		var ss = decodeURI(location.search.replace('?', ''));
        var info = ss.split('&');
        var score = -1;
        ScCode = info[0];
		OrderName = info[1];
		//alert("info-"+ScCode+"--"+OrderName);
		getInfoByAjax('LastOrders', ScCode, OrderName);
			
	}
    
    function getInfoByAjax(searchText, searchValue, searchValue2) {
		$.ajax({
			type : "post",
			url : "servlet/SearchInfoServlet",
			data : {
				paramName : searchText,
				paramText : searchValue,
				paramText2 : searchValue2,
			},
			dataType : "json",
			success : function(data, textStatus) {
			
			    loadingParamsList(data);

			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				alert("上序信息查询失败，请重试！"); //+ textStatus + errorThrown
			}
		});

	}
	
	function  loadingParamsList(data){
	      var body = "";
		$("#Div_LastOrder").empty();	
       
        if(data.length != 0){   
             //上序信息加载    

            $("#Team").html(data[0]['JH_Zx_Bz'])
             body +=("<ul>");
            for(var i=0;i<data.length;i++){
               body +=("<li class=\"li_noborder\"><label><input class=\"radio\" onchange=\"radioChange()\" name=\"Order\" type=\"radio\" value=\""+data[i]['Gx_Code']+"_"+data[i]['Gx_Name']+"\" /><a>"+data[i]['Gx_Code']+"   "+data[i]['Gx_Name']+"</a> </label></li> ");
            
            }
             body +=("</ul>");
        }
        
       $("#Div_LastOrder").append(body);
	   $("#Div_LastOrder").show();
	   body = "";
	}
	
	function SaveOrderSubmit(){
	
	if($('input:radio:checked').val() ==''){
	   alert("请勾选上序！！！");
	
	}else{
	
	   saveOrderEvalByAjax('SaveLastOrder',lOrderInfo[0],lOrderInfo[1],aScore,$('#content').val(),ScCode,OrderName);
	
	}
	
//	alert("选择："+$('input:radio:checked').val()+"---"+aScore+"--"+$('#content').val());
	
	}
	
	//公用ajax
	function saveOrderEvalByAjax(searchText,value1,value2,value3,value4,value5,value6){
		$.ajax({
			type : "post",
			url : "servlet/SaveInfoServlet",
			data : {
				paramName : searchText,
				paramText : value1,
				paramText2 : value2,
				paramText3 : value3,
				paramText4 : value4,
				paramText5 : value5,
				paramText6 : value6,
			},
			dataType : "text",
			success : function(data, textStatus) {
			  //  alert("生产计划" + JSON.stringify(data));
		       if(data=true){
		          window.history.go(-1);
		       }else{
		          alert("保存失败，请重试！！");
		       }
			   
			     
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				alert("生产计划查询失败，请重试！"); //+ textStatus + errorThrown
			}
		});

	
	}

     function radioChange(){
           var str = $('input:radio:checked').val();
	        lOrderInfo = str.split('_');
         //   getEvalOrderInfoByAjax('EvalLastOrder',lOrderInfo[0]);
       
     }
     
     //公用ajax
	function getEvalOrderInfoByAjax(searchText, searchValue) {
		$.ajax({
			type : "post",
			url : "servlet/SearchInfoServlet",
			data : {
				paramName : searchText,
				paramText : searchValue,
				paramText2 : ScCode,
				paramText3 : OrderName
			},
			dataType : "json",
			success : function(data, textStatus) {
			//
				

			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				alert("生产计划查询失败，请重试！"); //+ textStatus + errorThrown
			}
		});

	}

</script>
  </head>
  
  <body style="background-color: #F0F0F0;padding-left: 0em;padding-right: 0em;">
      <div style="width:100%;">
          <ul >
             <li class = "li_head"  ><a id="paramName">上序信息</a></li>
           
             <li class="parentLi" style="height: auto">
                 <div class="childrenLeft"><a class="f3">工序：</a></div>
                 <div class="childrenRight" id="Div_LastOrder">
                    
                 </div>
            
             </li>
             <li class="li_body" ><a >班组：</a><a id="Team">材料准备经营体</a></li>
             <li class="li_body sLi" ><a style="font-size: 2.8em">评分：</a><a style="padding: "> <div id="star" data-num="1" style="clear:both;"></div></a></li> 
             <li class="parentLi" style="height: auto">
                 <div class="childrenLeft"><a class="f3">备注：</a></div>
                 <div class="childrenRight">
                 <script src="https://www.jq22.com/jquery/jquery-1.10.2.js"></script>  
                 <textarea id="content" rows="" cols="" style="width: 100%;min-height:3.5em;height:auto;vertical-align: top"  placeholder="请输入实测结果值"></textarea>
                 <span class="contentcount" style="margin-left: 80%;font-size: 2.3em">0</span><span style="font-size: 2.3em">/140</span>
                <script type="text/javascript" src="./Js/SubmitCommon.js"></script>
                 </div>
            
             </li>
          
           </ul>
         
           <div style="position: relative;margin-top:5em;;padding-left: 15%;">
             <button class="btn change3 " style="margin-right: 18%"><span>拍照</span></button>
             <button class="btn change3 "  onclick="SaveOrderSubmit()"><span>提交</span></button>  
           </div>
      </div>  
      <br>
      <br>
      <br>
      <div id="star" data-num="1" style="clear:both;background-color: red;">
      <script type="text/javascript" src="./Js/jquery.raty.min.js"></script>
      <script type="text/javascript" src="./Js/jquery.raty.js"></script>
      <script >
      var aScore = 1;
       $(function(){
         //    alert("jinru");
             $("#star").raty({
                   number: 5,	
		           targetType: 'hint',
                   hints: ['1','2', '3', '4', '5'],
             score:function(){
                 
                     return $(this).attr("data-num");
                 },
                 starOn:'img/star-on-big.png',
                 starOff:'img/star-off-big.png',
                 starHalf:'img/star-half-big.png',
                 readOnly:false,
                 halfShow:true,
                 size:105,
               
               mouseover : function(score,evt){
               //    alert('score' + score);
                   aScore = score;
               } 
                
             });         
            
            
         });
        
        
         
</script>
      </div>
  

  </body>
</html>
